#include <prototype_pattern.h>
#include <iostream>

Prototype* ProRectangle::clone()
{
    return new ProRectangle();
}

string ProRectangle::type()
{
    return "Rectangle";
}

Prototype* ProCircle::clone()
{
    return new ProCircle();
}

string ProCircle::type()
{
    return "Circle";
}

void ShapeCache::loadCache()
{
    shapeMap[0] = new ProRectangle();
    shapeMap[1] = new ProCircle();
}

Prototype* ShapeCache::getShape(int Id)
{
    if(Id >= 2)
    {
        return nullptr;
    }
    return shapeMap[Id]->clone();
}
